import React from "react";
import ReactDOM from "react-dom/client";
import { SettingOutlined, DashboardOutlined, CompassOutlined, AppstoreOutlined, TeamOutlined, ApiOutlined, ShareAltOutlined } from '@ant-design/icons';
import { RiFoldersFill } from '@remixicon/react';

import { ViewerPage, AboutSettingView, DataViewerPage, FlowEditor, AIKeySettingView, ApplicationHomePage, MyApplicationsPage, DiscoveryHomePage, ProjectApplicationPublishPage, DiscoveryResultPage, MySharePage, WorkspacesPage, ProjectApplicationPage, ChatPage, ProjectApplicationPreviewPage, OllamaSettingPage } from "./pages";
import { ApplicationViewer } from './components';
import { MyApplicationsTable } from "./pages/apps/components/my-applications-table";

import { MGApplication } from '.';
import { ApplicationPage } from "./pages/application";
import { ToolsPage } from "./pages/tools/tools-page";

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
  <React.StrictMode>
    <MGApplication
      name={'图灵忆'}
      index={'/home'}
      pages={[
        {
          path: '/home',
          element: <ViewerPage></ViewerPage>,
          title: '画图',
          icon: <i>G</i>,
          isMenu: true,
        },
        {
          path: '/data',
          element: <DataViewerPage></DataViewerPage>,
          title: '数据',
          icon: <i>01</i>,
          isMenu: true,
        },
        {
          path: '/data/:sub',
          element: <DataViewerPage></DataViewerPage>,
        },
        {
          path: '/data/dataflow/:type/:workflow/:back',
          element: <FlowEditor></FlowEditor>,
        },
        {
          path: '/workspaces',
          element: <WorkspacesPage></WorkspacesPage>,
          title: '工作室',
          icon: <RiFoldersFill style={{ width: '20px' }} />,
          isMenu: true,
        },
        {
          path: '/workspaces/app/:identifier',
          element: <ProjectApplicationPage></ProjectApplicationPage>,
        },
        {
          path: '/workspaces/publish/:identifier',
          element: <ProjectApplicationPublishPage></ProjectApplicationPublishPage>,
        },
        {
          path: '/discovery',
          element: <DiscoveryHomePage></DiscoveryHomePage>,
          title: '发现',
          icon: <CompassOutlined />,
          isMenu: false,
        },
        {
          path: '/discovery/:category/:keywords',
          element: <DiscoveryResultPage></DiscoveryResultPage>,
        },
        {
          path: '/application/true/:identifier',
          element: <ApplicationPage></ApplicationPage>,
          layoutHiden: true,
        },
        {
          path: '/application/false/:identifier',
          element: <ApplicationPage></ApplicationPage>,
        },
        {
          path: '/apps',
          element: <ApplicationHomePage></ApplicationHomePage>,
          title: '应用',
          icon: <AppstoreOutlined />,
          isMenu: true,
        },
        {
          path: '/apps/:sub',
          element: <ApplicationHomePage></ApplicationHomePage>,
          title: '应用',
          icon: <AppstoreOutlined />,
        },
        {
          path: '/apps/myapps',
          element: <MyApplicationsPage></MyApplicationsPage>,
          title: '我的应用',
          icon: <AppstoreOutlined />,
        },
      ]}
      chatPageShown={true}
      settings={[{
        group: '模型',
        children: [
          {
            icon: <ApiOutlined />,
            title: '模型供应商',
            code: 'model_provider',
            element: <AIKeySettingView></AIKeySettingView>,
          },
          {
            icon: <ShareAltOutlined />,
            title: 'Ollama',
            code: 'model_ollama',
            element: <OllamaSettingPage></OllamaSettingPage>,
          },
          {
            icon: <ShareAltOutlined />,
            title: '图片模型',
            code: 'model_image',
            element: <></>,
          }
        ]
      }, {
        group: '我的',
        children: [
          {
            icon: <ShareAltOutlined />,
            title: '我的分享',
            code: 'share',
            element: <MySharePage></MySharePage>,
          },
          {
            icon: <AppstoreOutlined />,
            title: '我的应用',
            code: 'myapps',
            element: <MyApplicationsTable></MyApplicationsTable>,
          },
        ]
      }, {
        group: '设置',
        children: [
          {
            icon: <ShareAltOutlined />,
            title: '工具',
            code: 'tools',
            element: <ToolsPage></ToolsPage>,
          },
          {
            icon: <AppstoreOutlined />,
            title: '功能',
            code: 'features',
            element: <MyApplicationsTable></MyApplicationsTable>,
          }
        ]
      }, {
        group: '软软G01',
        children: [
          {
            icon: <TeamOutlined />,
            title: '关于',
            code: 'about',
            element: <AboutSettingView></AboutSettingView>,
          }
        ]
      }]} />
  </React.StrictMode>,
);